<?php
namespace collecter\controllers;

use common\models\User;
use Yii;

/**
 * 公用控制器
 */
class CommonController extends \yii\web\Controller{

    //public $enableCsrfValidation = false;

    public $loginUid = 0;
    public $loginUser = null;

    public function init(){
        parent::init();
        header("Content-Type;text/html; charset=utf-8");

        $this->loginUid = isset(Yii::$app->user->id) ? intval(Yii::$app->user->id) : 0;

        if($this->loginUid > 0){
            $this->loginUser = User::findIdentity($this->loginUid);
            //echo '<pre>';print_r($this->loginUser->attributes);
        }else{
            header("Location:"."/login/login.html");exit;
        }

    }


}
